package com.ll.admin.action;

import com.ll.admin.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 公共法人Action,登录、注销，授权、欢迎
 */
@Controller
public class CommonAction {
    @Autowired
    private IMemberService memberService ;
    //登录
    @RequestMapping("/login")
    public String login() {
        return "login" ;
    }
    //注销
    @RequestMapping("/logout")
    public String forwardLogout() {
        return "forward:/index.jsp" ;
    }
    //授权异常
    @RequestMapping("/noauthz")
    public ModelAndView noauthz(String authzError) {
        ModelAndView modelAndView = new ModelAndView("login") ;
        modelAndView.addObject("authzError","该账户没有此授权!") ;
        return modelAndView ;
    }
    //授权-权限异常
    @RequestMapping("/unauthorized")
    public ModelAndView unauthorized() {
        ModelAndView modelAndView = new ModelAndView("login") ;
        modelAndView.addObject("authzError","该账户权限异常!") ;
        return modelAndView ;
    }
    //授权-身份异常
    @RequestMapping("/unauthenticated")
    public ModelAndView unauthenticated() {
        ModelAndView modelAndView = new ModelAndView("login") ;
        modelAndView.addObject("authzError","该账户身份异常!") ;
        return modelAndView ;
    }
    //欢迎
    @RequestMapping("/pages/index")
    public String index() {
        return "index" ;
    }
}
